From f69f1b22dad83fd11cf4a7ca5d2d1e796e44a268 Mon Sep 17 00:00:00 2001 From: oliskoli Date: Wed, 14 Feb 2007 21:20:33 +0000 Subject: [PATCH] Store only the part of seconds for trackpoints (computed from milliseconds). Rebuild reference data. --- defs.h | 2 ++ stmwpp.c | 10 +++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/defs.h b/defs.h index ba16cca36..8262323ea 100644 --- a/defs.h +++ b/defs.h @@ -163,6 +163,8 @@ extern const char gpsbabel_version[]; extern time_t gpsbabel_now; /* gpsbabel startup-time; initialized in main.c with time() */ extern time_t gpsbabel_time; /* gpsbabel startup-time; initialized in main.c with current_time(), ! ZERO within testo ! */ +#define MILLI_TO_MICRO(t) (t * 1000) /* Milliseconds to Microseconds */ +#define MICRO_TO_MILLI(t) (t / 1000) /* Microseconds to Milliseconds*/ #define CENTI_TO_MICRO(t) (t * 10000) /* Centiseconds to Microseconds */ #define MICRO_TO_CENTI(t) (t / 10000) /* Centiseconds to Microseconds */ diff --git a/stmwpp.c b/stmwpp.c index f82f5e43c..184245424 100644 --- a/stmwpp.c +++ b/stmwpp.c @@ -137,9 +137,9 @@ stmwpp_data_read(void) case 6: sscanf(c, "%d:%d:%d.%d", &time.tm_hour, &time.tm_min, &time.tm_sec, &fracsec); - wpt->microseconds = CENTI_TO_MICRO(fracsec); - if (what == STM_TRKPT) - wpt->microseconds /= 10; + wpt->microseconds = MILLI_TO_MICRO(fracsec); + /* makes sense only for recorded trackpoints */ + if (what != STM_TRKPT) wpt->microseconds = 0; break; default: @@ -249,10 +249,10 @@ stmwpp_waypt_cb(const waypoint *wpt) { case STM_WAYPT: case STM_RTEPT: - gbfprintf(fout, ".%02d", MICRO_TO_CENTI(wpt->microseconds)); + gbfprintf(fout, ".%02d", 0); break; case STM_TRKPT: - gbfprintf(fout, ".%03d", MICRO_TO_CENTI(wpt->microseconds * 10)); + gbfprintf(fout, ".%03d", MICRO_TO_MILLI(wpt->microseconds)); break; } gbfprintf(fout, ",\r\n"); -- 2.30.2